#include <stdio.h>
#include <stdlib.h>

//https://leetcode.cn/problems/find-all-numbers-disappeared-in-an-array/

int compare(const void *A, const void *B) {
    return *(int *) A - *(int *) B;
}

int *findDisappearedNumbers(int *nums, int numsSize, int *returnSize) {
    int *rets = (int *) malloc(sizeof(int) * numsSize * 2);
    *returnSize = 0;
    qsort(nums, numsSize, sizeof(int), compare);

    int indexNums = 0;
    int N = 1;
    while (indexNums < numsSize && N <= numsSize) {
        if (nums[indexNums] == N) {
            indexNums++;
            N++;
        } else if (nums[indexNums] > N) {
            rets[*returnSize] = N;
            (*returnSize)++;
            N++;
        } else if (nums[indexNums] < numsSize) {
            indexNums++;
        }
    }
    while (N <= numsSize) {
        rets[*returnSize] = N;
        (*returnSize)++;
        N++;
    }
    return rets;
}

int main() {

    return 0;
}